const {loginCheck} = require('../controller/user');
const {SuccessModal,ErrorModal} = require('../model/resModal');

const handleUserRouter = (req,res) => {
  const method = req.method;

  
  //登录
  if(method === 'POST' && req.path === '/api/blog/login'){
    const {username,password} = req.body
    const result = loginCheck(username,password)
    if(result){
      return new SuccessModal()
    }else{
      return new ErrorModal('登录失败');
    }   
  }

}


module.exports = handleUserRouter;
